<?php
include($_SERVER["DOCUMENT_ROOT"]."/bob.php");
include("fonctions_forum.php");
$mysqli = new_mysqli($host, $user, $password, $database); //connection à la DB
entete($mysqli, "Forum"); 

display_forums($mysqli, 0, false);
$nb_gens = mysqli_query_with_error($mysqli, "SELECT COUNT(*) as count FROM gens")->fetch_assoc();
$nb_posts = mysqli_query_with_error($mysqli, "SELECT COUNT(*) as count FROM forum_posts")->fetch_assoc();
$nb_sessions = mysqli_query_with_error($mysqli, "SELECT COUNT(*) as count FROM sessions")->fetch_assoc();
?>

				<div id="legende" class="ombre">
					<h4 class="ombre">Légende des icônes</h4>
					<p>
						<span class="nonlu">contient des messages non lus</span><br/>
						<span class="lu">ne contient pas de messages non lus</span><br/>
						<span class="verrouille">discussion verouillée</span>
					</p>
				</div>
				<div id="stats" class="ombre">
					<h4 class="ombre">Statistiques du forum</h4>
					<p>
                                            
						Les membres ont posté un total de <?php echo $nb_posts['count'] ?> messages.<br/>
						Il y a en tout <?php echo $nb_sessions['count'] ?> utilisateur<?php ((get_num($nb_sessions['count']) > 1) ? 's' : '') ?> en ligne.<br/>
						Le nombre d’utilisateurs inscrits est <?php echo $nb_gens['count'] ?>.
					</p>
				</div>
<?php
if(isset($_SESSION['id']) && get_data_in_db($mysqli, "gens", "user_id", $_SESSION['id'], "user_level") == '1')
	echo "<p align='center'><a href='admin'>Panneau d'admin</a></p>";?>

                        </div> <!-- fin div contenu-->
            </div> <!-- fin div corps-->
	

<?php

show_footer();
?>
</div></body></html>